package com.spring.AOP;

import com.spring.AOP.AopInterface.JoinPoint;

import java.lang.reflect.Method;
import java.util.Arrays;

public class DefaultJoinPoint implements JoinPoint {
    private final Object target;
    private final Method method;
    private final Object[] args;

    public DefaultJoinPoint(Object target, Method method, Object[] args) {
        this.target = target;
        this.method = method;
        this.args = args;
    }

    @Override
    public Object getTarget() {
        return target;
    }

    @Override
    public Method getMethod() {
        return method;
    }

    @Override
    public Object[] getArgs() {
        return args;
    }

    @Override
    public String toString() {
        return "JoinPoint{" +
                "target=" + target.getClass().getSimpleName() +
                ", method=" + method.getName() +
                ", args=" + Arrays.toString(args) +
                '}';
    }
}
